/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.ProtocalStateMachines;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.Kernel.Operation;
import edu.pku.sei.modeler.model.uml.Kernel.Constraint;
import edu.pku.sei.modeler.model.uml.Kernel.Constraint;

import edu.pku.sei.modeler.model.uml.BehaviorStateMachines.Transition;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;

/**
 * @generated
 *
 */
public class ProtocolTransition extends Transition implements IProtocolTransition {
	// attributes
	
	
	
	
	// references
	
	protected MetaTypedList referred;
	
	protected MetaTypedList postCondition;
	
	protected MetaTypedList preCondition;
	
	
	
	// getters & setters for attributes
	
	// getters for references
	
	public MetaTypedList getReferred() {
		if(referred == null) {
			referred = new MetaTypedList(Operation.class, this, ModelPackage.PROTOCOLTRANSITION_REFERRED);
		}
		return referred;
	}
	
	public MetaTypedList getPostCondition() {
		if(postCondition == null) {
			postCondition = new MetaTypedList(Constraint.class, this, ModelPackage.PROTOCOLTRANSITION_POSTCONDITION);
		}
		return postCondition;
	}
	
	public MetaTypedList getPreCondition() {
		if(preCondition == null) {
			preCondition = new MetaTypedList(Constraint.class, this, ModelPackage.PROTOCOLTRANSITION_PRECONDITION);
		}
		return preCondition;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.PROTOCOLTRANSITION_REFERRED, referred);		
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.PROTOCOLTRANSITION_POSTCONDITION, postCondition);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.PROTOCOLTRANSITION_PRECONDITION, preCondition);
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		// references
		
		this.getReferred().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.PROTOCOLTRANSITION_REFERRED, this));
		
		this.getPostCondition().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.PROTOCOLTRANSITION_POSTCONDITION));
		
		this.getPreCondition().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.PROTOCOLTRANSITION_PRECONDITION));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.PROTOCOLTRANSITION_REFERRED.equals(featureID)) {
			getReferred().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 